package com.itheima.controller;


import com.itheima.pojo.PageResult;
import com.itheima.service.searchGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/goods")
public class searchGoodsController {


    @Autowired
   searchGoodsService searchGoodsService;

    @RequestMapping("/search/{page}/{pageSize}")
    public PageResult search(@PathVariable("page") Integer page,
                             @PathVariable("pageSize") Integer pageSize,
                             @RequestParam("keyword") String keyword,
                             @RequestParam(required = false) String price,
                             @RequestParam(required = false) String sort,
                             @RequestParam(required = false) boolean order){

        return searchGoodsService.search(page,pageSize,keyword,price,sort,order);
    }


}
